import {onMounted,onUnmounted,ref} from 'vue'
export default function useGetMousePosition(){
    const x =ref(0);
    const y =ref(0);
    const updataPosition=(e:MouseEvent)=>{
      x.value=e.pageX;
      y.value=e.pageY
    }
    onMounted(()=>{
      document.addEventListener('click',updataPosition)
    });
    onUnmounted(()=>{
      document.removeEventListener('click',updataPosition)
    });
    return{
        x,y
       }   
}